$(function () {
  var winWidth = $(window).width();
  var winHeight = $(window).height();
  function animate($dom, obj, callback) {
    $dom.animate(obj, 400, 'swing');
  }

  $('#banner--container').css({
    width: winWidth,
    height: winHeight
  })

  // $('#logo--ray').slideDown(2000, function () {
  //   $('#logo--ray').animate({
  //     opacity: 0
  //   });
  // });

  $('.desc-container').css({
    width: winWidth,
    height: winWidth / 1200 * 514
  });

  function handleFaked(direction) {
    var $dom = $('.desc-container.faked');
    if (direction === 'down') {
      $dom.css({
        opacity: 0
      });
      $('#desc').css({
        opacity: 1
      })
    }
    else {
      $dom.css({
        opacity: 1
      });
      $('#desc').css({
        opacity: 0
      })
    }
  }

  $('.desc-container.faked').waypoint({
    handler: handleFaked
  });

  var windowScrollTop = $(window).scrollTop();

  handleFaked(windowScrollTop > 760 ? 'down' : 'up');

  $('.footer--totop img').click(function () {
    $(document.body).animate({
      scrollTop: 0
    });
  })
}); 